package cn.com.yang.server.jetty;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandler;

/**
 * Jetty容器配置单个Context
 * TODO
 * @author yangyijin
 * @since 2023年5月18日-下午5:59:49
 */
public class JettyOneContext {
	// org.eclipse.jetty.io.ManagedSelector
	public static void main(String[] args) throws Exception {
		Server server = new Server(8080);
		// 增加一个唯一的handler给context "/hello";
		ContextHandler context = new ContextHandler();
		context.setContextPath("/hello");
		context.setHandler(new JettyHelloHandler());
		// 在http://localhost:8080/hello 访问服务
		server.setHandler(context);
		// 启动服务
		server.start();
		server.join();
		// org.eclipse.jetty.util.thread.QueuedThreadPool  
		// ran ReservedThreadExecutor@1a968a59{s=1/4,p=0}@27f25881 in QueuedThreadPool[qtp312116338]@129a8472{STARTED,8<=8<=200,i=3,r=4,q=0}[ReservedThreadExecutor@1a968a59{s=0/4,p=0}]
		// org.eclipse.jetty.io.ManagedSelector 
		// - Selector sun.nio.ch.WindowsSelectorImpl@55761988 waiting with 1 keys
	}
}
